package testeditor;

import javax.swing.UIManager;
import java.awt.*;

public class Application1 {
    private boolean packFrame = false;

    //Construire l'application
    public Application1() {
        Cadre1 frame = new Cadre1();
        //Valider les cadres ayant des tailles prédéfinies
        //Compacter les cadres ayant des infos de taille préférées - ex. depuis leur disposition
        if (packFrame) {
            frame.pack();
        }
        else {
            frame.validate();
        }
        //Centrer la fenêtre
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize = frame.getSize();
        if (frameSize.height > screenSize.height) {
            frameSize.height = screenSize.height;
        }
        if (frameSize.width > screenSize.width) {
            frameSize.width = screenSize.width;
        }
        frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
        frame.setVisible(true);
    }
    //Méthode main
    public static void main(String[] args) {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        }
        catch(Exception e) {
            e.printStackTrace();
        }
        new Application1();
    }
}